# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.

import pyautogui
import datetime
import time
import sys

timeCur = datetime.datetime.now()


def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')
    print_hi('time:{}'.format(timeCur.timestamp()))
    # print_hi('path:{}'.format(sys.path))

    # timeCur = datetime.datetime.now()
    # timeYesterdayStr = datetime.datetime.fromtimestamp(timeCur.timestamp()-60*60*24).strftime('%Y-%m-%d')
    # timeYesterdayStr = timeYesterdayStr + '  09:00:00'
    # timeTodayStr = '{}-{}-{} 09:00:00'.format(timeCur.year, timeCur.month, timeCur.day)
    # #
    # #
    # print_hi('昨天：{}    今天：{}'.format(timeYesterdayStr, timeTodayStr))
    # timeYesterday = time.strptime(timeYesterdayStr, '%Y-%m-%d %H:%M:%S')
    # timeToday = time.strptime(timeTodayStr, '%Y-%m-%d %H:%M:%S')
    # print_hi('昨天：{}    今天：{}'.format(int(time.mktime(timeYesterday)), int(time.mktime(timeToday))))
    for index in range(1, 1000):
        time.sleep(60 * 3)
        current_position = pyautogui.position()
        pointX = current_position.x
        pointY = current_position.y
        print_hi('点击次数：{}  (x, y) : ({}，{})'.format(index, pointX, pointY))
        # time.sleep(60 * 5)
        timeCur = datetime.datetime.now()
        if index % 2 == 1:
            pointX = pointX + 300
        else:
            pointX = pointX - 300
        pyautogui.moveTo(pointX, pointY)
        pyautogui.click()
        print_hi('点击次数：{} (x, y) : （{}，{}）time:{}'.format(index, pointX, pointY, timeCur))
        # print_hi('点击次数：{}  time:{}'.format(index, timeCur))
        # time.sleep(60*5)



# See PyCharm help at https://www.jetbrains.com/help/pycharm/
